const setRem = () => {
  const width = document.documentElement.clientWidth;
  document.documentElement.style.fontSize = width / 10 +'px';
}

setRem();

// 横屏事件
// window.addEventListener('orientationchange', setRem);
window.addEventListener('resize', setRem);